#include "INF_key.h"

//返回按下的按键
Key_Type INF_key_scan(void){
    Key_Type key = KEY_NONE;
    HAL_ADC_Start(&hadc1);
    uint32_t adc_value = HAL_ADC_GetValue(&hadc1);
    //按键1
        if (adc_value==0)
        {
            key = KEY1;
        }
        else if(adc_value>1900&&adc_value<2100){
            key = KEY2;
        }
        else if(adc_value>2500&&adc_value<2700){
            key = KEY3;
        }
        else if(adc_value>2800&&adc_value<3000){
            key = KEY4;
        }
        else{
            key = KEY_NONE;
        }
    return key;
}
